package game;

import java.util.LinkedList;

public class Player {
	protected String playerName;
	protected LinkedList<Card> playerCards;
	protected boolean stillAlive;
	
	public Player(String playerName) {
		this.playerName=playerName;
		playerCards=new LinkedList<>();
		stillAlive=true;
	}
	
	public void addCard(Card theCard) {
		theCard.setOwner(this);
		playerCards.add(theCard);
	}
	
	public void addCards(LinkedList<Card> cardList) {
		for(Card theCard: cardList) {
			addCard(theCard);
		}
	}
	
	public Card getCard() {
		if(playerCards.isEmpty())
			return null;
		else
			return playerCards.removeFirst();
	}
	
	public int getCardCount() {
		return playerCards.size();
	}
	
	public boolean isStillAlive() {
		return stillAlive;
	}
	
	public void setActive(boolean b) {
		stillAlive = b;
	}
	
	public String getName() {
		return playerName;
	}
}
